#include "LeafElement.h"



LeafElement::LeafElement(const QString& iconPath, const int& index, const QString& cmdKey)
	:UIElement(), _iconPath(iconPath), _pixRect(),_index(index), _cmdKey(cmdKey)
{
}

void LeafElement::repeat()
{

}

void LeafElement::finish()
{
}

void LeafElement::shortPress()
{
	//Do Command  
}

void LeafElement::longPress()
{

}

void LeafElement::drawElement(QWidget* widget, QPainter* painter, bool bSelected, const QRect& rect)
{
	Q_UNUSED(rect);
	Q_UNUSED(widget);
	if (bSelected) {
		drawMainIcon(painter);
	}
}

void LeafElement::drawMainIcon(QPainter* painter)
{
	QPixmap pixmap(_iconPath);
	if (pixmap.isNull()) {
		return;
	}
	_pixRect = QRect(QPoint(14, 181), pixmap.size());
	painter->drawPixmap(_pixRect, pixmap);
}

